package model;

import java.util.ArrayList;
import java.util.List;

public class Teacher extends Person {
    private List<Course> courses = new ArrayList<>();

    public Teacher(String name) {
        super(name);
    }

    public void offerCourse(Course course) {
        course.setTeacher(this);
        courses.add(course);
        System.out.println(name + "开设了课程: " + course.getCourseName());
    }

    @Override
    public void printSchedule() {
        System.out.println("\n" + name + "的课表:");
        if (courses.isEmpty()) {
            System.out.println("暂无教学课程");
        } else {
            courses.forEach(Course::displayInfo);
        }
    }
}